package com.sx.zongzhi.presenter;

import com.sx.zongzhi.MyApplication;
import com.sx.zongzhi.bean.KeyPunishDetailBean;
import com.sx.zongzhi.modle.ApiManager;
import com.sx.zongzhi.net.BaseCallBack;
import com.sx.zongzhi.net.BaseResult;
import com.sx.zongzhi.view.IKeyPunishDetailView;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by XZY on 2017/11/30.
 *整治排查详情
 */
public class KeyPunishDetailPest {

    private IKeyPunishDetailView punishDetailView;

    public KeyPunishDetailPest(IKeyPunishDetailView punishDetailView) {
        this.punishDetailView=punishDetailView;
    }


    /**
     * id 整治排查id
     */
    public void getKeyPunishDetail(String id){
        Map<String,Object> map=new HashMap<>();
        map.put("sid", MyApplication.sid);
        map.put("id", id);
        new ApiManager().getKeyPunishDetail(map, new BaseCallBack<BaseResult<KeyPunishDetailBean>>() {
            @Override
            public void onSuccess(BaseResult<KeyPunishDetailBean> response) {
                punishDetailView.getKeyPunishDetail(response.getData());
            }
            @Override
            public void onFailures(String message) {
                punishDetailView.showError(message);
            }
        });
    }

    /**
     * 删除
     * @param id 重点行业id
     */
    public void KeyPunishDelete(String id){
        Map<String,Object> map=new HashMap<>();
        map.put("sid", MyApplication.sid);
        map.put("id", id);
        new ApiManager().KeyPunishDelete(map, new BaseCallBack<BaseResult<Boolean>>() {
            @Override
            public void onSuccess(BaseResult<Boolean> response) {
                punishDetailView.KeyPunishDelete("删除成功");
            }
            @Override
            public void onFailures(String message) {
                punishDetailView.showError(message);
            }
        });
    }

}
